package org.hit.burkun.obo.model;

import javax.annotation.Nonnull;

public class Synonym {
	public enum Type {
		EXACT("EXACT"), BROAD("BROAD"), NARROW("NARROW"), RELATED("RELATED"), ALT_ID(
				"ALT_ID");
		@Nonnull
		private final String tag;

		Type(@Nonnull String tag) {
			this.tag = tag;
		}

		/** @return tag */
		@Nonnull
		public String getTag() {
			return tag;
		}

		@Override
		public String toString() {
			return tag;
		}

		public static Type getType(String tag) {
			if (tag.equals(EXACT.getTag())) {
				return EXACT;
			} else if (tag.equals(BROAD.getTag())) {
				return BROAD;
			} else if (tag.equals(NARROW.getTag())) {
				return NARROW;
			} else if (tag.equals(RELATED.getTag())) {
				return RELATED;
			} else {
				return null;
			}
		}
	}

	private Type type = Type.RELATED;
	private String accSynonym; // alter id
	private String name;
	// synonym: "glial cell generation" EXACT systematic_synonym []
	private String category;

	// cross ref
	// private Collection<Dbxref> xrefs = null;

	// public Collection<Dbxref> getXrefs() {
	// return xrefs;
	// }
	// public void setXrefs(Collection<Dbxref> xrefs) {
	// this.xrefs = xrefs;
	// }
	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		if (type != null) {
			this.type = type;
		} else {
			this.type = Type.RELATED;
		}
	}

	public void setType(String type) {
		Type t = Type.getType(type);
		setType(t);
	}

	public String getAccSynonym() {
		return accSynonym;
	}

	public void setAccSynonym(String accSynonym) {
		this.accSynonym = accSynonym;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	// public String toString(){
	// if(this.type == Type.ALT_ID){
	// return this.type.getTag() + ":" + this.accSynonym;
	// }
	// return this.name + this.type + this.xrefs;
	// }
}
